package com.hmy.finance.api.common.enums.receipt;

import lombok.Getter;

@Getter
public enum AccountStatusEnum {
    //'NORMAL', 'LOCKED'

    NORMAL("1", "正常"),
    LOCKED("2", "锁定");

    private final String value;
    private final String desc;

    AccountStatusEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    //Get AccountStatusEnum By Value
    public static AccountStatusEnum getByValue(String value) {
        for (AccountStatusEnum accountStatusEnum : AccountStatusEnum.values()) {
            if (accountStatusEnum.getValue().equals(value)) {
                return accountStatusEnum;
            }
        }
        return null;
    }

    //Get Desc By Value
    public static String getDescByValue(String value) {
        AccountStatusEnum enumItem = getByValue(value);
        if (enumItem == null) {
            return null;
        }
        return enumItem.getDesc();
    }
}
